<!DOCTYPE html>
<html>


<!-- Mirrored from /theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>修改兑换商品</title>
    <meta name="keywords" content="修改兑换商品">
    <meta name="description" content="修改兑换商品">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="http://news.xiangtws.com/__PUBLIC__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.min.css" rel="stylesheet">


    <link href="__PUBLIC__/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="http://news.xiangtws.com/__PUBLIC__/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title" style="min-height: 65px;margin-bottom: 15px;">
                    <h5>
                        <a href="<?=U('ExchangeGoods/index')?>" title="兑换列表">
                            <button type="button" class="btn btn-primary">兑换列表</button>
                        </a>
                    </h5>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="formSubmit">
                        <input name="id" value="{$info.id}" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品名称</label>
                            <div class="col-sm-5">
                                <input type="text" name="title" class="form-control" value="{$info.title}" required>
                            </div>
                        </div>
                        <if condition="$info['u_id'] neq 0">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">发布门店</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" value="{$store1.storename}({$store1.address})" readonly>
                                </div>
                            </div>

                            <else />

                            <div class="form-group">
                                <label class="col-sm-2 control-label">限制小区</label>
                                <div class="col-sm-2" style="position: relative">
                                    <input class="form-control" type="text" name="store_key" placeholder="请输入店铺名" style="margin-bottom: 15px;">
                                    <button type="button" class="btn btn-info" onclick="searchStore()" style="position: absolute;top: 0px;left: 320px;">
                                        搜索
                                    </button>
                                    <select class="form-control store-select">
                                        <option></option>
                                    </select>
                                </div>
                                <div class="col-sm-3 store-input" style="margin-top: 48px;">
                                    <volist name="store" id="vo">
                                        <p class="store-p" style="position: relative">
                                            <input class="form-control" type="text" value="{$vo.storename}（{$vo.address}）">
                                            <input type="hidden" name="c_id[]" value="{$vo.c_id}">
                                            <button type="button" class="btn btn-danger btn-store" onclick="re(this)"  style="position: absolute;top: 0px;left: 499px;height: 34px;">移除</button>
                                        </p>
                                    </volist>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">(一级)省</label>
                                <div class="col-sm-5">
                                    <select class="form-control select-1">
                                        <option value="0">请选择</option>
                                        <volist name="areali" id="vo">
                                            <option value="{$vo.id}" <?=$vo['id']==$info['area1_id']?'selected':''?> >{$vo.name}		编号:{$vo.area_id}（{$vo.id}）</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">(二级)市</label>
                                <div class="col-sm-5">
                                    <select class="form-control select-2" name="area_id">
                                        <option value="{$info.area_id}">
                                            {$info.area_name}       编号:{$info.area_id_id}（{$info.area_id}）
                                        </option>
                                    </select>
                                </div>
                            </div>
                        </if>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品原价</label>
                            <div class="col-sm-5">
                                <input type="text" name="price" value="{$info.price}" class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品库存</label>
                            <div class="col-sm-5">
                                <input type="text" name="num" value="{$info.num}" class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品每份份量</label>
                            <div class="col-md-2">
                                <input type="number" name="u_num" value="{$info.u_num}" placeholder="" class="form-control">
                            </div>
                            <div class="col-md-1">
                                <select data-placeholder="选择单位" name="unit" class="chosen-select form-control m-b" tabindex="2" style="width: 100px">
                                    <option value="0">未选择</option>
                                    <volist name="list_category" id="vo">
                                        <option value="{$vo.id}" <?=$vo['id']==$info['unit']?'selected':''?> hassubinfo="true">
                                            {$vo.title}
                                        </option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">普通会员兑换</label>
                            <div class="col-md-6">
                                <input style="width: 31.5%;float: left;margin-right: 20px;" name="level_cash_1" value="{$info.level_cash_1}" type="text" placeholder="现金" class="form-control" step="0.01">
                                <input style="width: 31.5%;float: left;" name="level_integral_1" value="{$info.level_integral_1}" type="text" placeholder="积分" class="form-control" step="0.01">
                                <!--<input style="width: 31.5%;float: left;" name="level_integral_1" type="text" placeholder="积分" class="form-control" step="0.01">-->
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">黄金会员兑换</label>
                            <div class="col-md-6">
                                <input style="width: 31.5%;float: left;margin-right: 20px;" name="level_cash_2" value="{$info.level_cash_2}" type="text" placeholder="现金" class="form-control" step="0.01">
                                <input style="width: 31.5%;float: left;" name="level_integral_2" value="{$info.level_integral_2}" type="text" placeholder="积分" class="form-control" step="0.01">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">白金会员兑换</label>
                            <div class="col-md-6">
                                <input style="width: 31.5%;float: left;margin-right: 20px;" name="level_cash_3" value="{$info.level_cash_3}" type="text" placeholder="现金" class="form-control" step="0.01">
                                <input style="width: 31.5%;float: left;" name="level_integral_3" value="{$info.level_integral_3}"type="text" placeholder="积分" class="form-control" step="0.01">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">钻石会员兑换</label>
                            <div class="col-md-6">
                                <input style="width: 31.5%;float: left;margin-right: 20px;" name="level_cash_4" value="{$info.level_cash_4}" type="text" placeholder="现金" class="form-control" step="0.01">
                                <input style="width: 31.5%;float: left;" name="level_integral_4" value="{$info.level_integral_4}" type="text" placeholder="积分" class="form-control" step="0.01">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">首页图片</label>
                            <div class="col-sm-5">
                                <input class="form-control" name="head_img" value="{$info.head_img}" placeholder="首页图片链接,多个链接用英文逗号分离">
                                <volist name="info.h_img" id="vo">
                                    <img height="150px" src="{$vo}" style="margin:0 10px;margin-top:15px;" />
                                </volist>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">内容图片</label>
                            <div class="col-sm-5">
                                <input class="form-control" name="con_img" value="{$info.con_img}" placeholder="首页图片链接,多个链接用英文逗号分离">
                                <volist name="info.c_img" id="vo">
                                    <img height="150px" src="{$vo}" style="margin:0 10px;margin-top:15px;" />
                                </volist>

                            </div>
                        </div>
                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-2 control-label">商品详情</label>-->
                            <!--<div class="col-sm-10">-->
                                <!--<div class="summernote">-->
                                    <!--{$info['content']}-->
                                <!--</div>-->
                                <!--<textarea name="content" style=" display:none;" value="{$info.content}"></textarea>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">状态</label>
                            <div class="col-sm-2">
                                <select class="form-control m-b" name="state">
                                    <option value="0" <?=$info['state']==0?'selected':''?>>待审</option>
                                    <option value="1" <?=$info['state']==1?'selected':''?>>通过</option>
                                    <option value="2" <?=$info['state']==2?'selected':''?>>不通过</option>
                                    <option value="3" <?=$info['state']==3?'selected':''?>>删除</option>
                                    <option value="4" <?=$info['state']==4?'selected':''?>>结束</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" onClick="save()">保存</button>
                                <a class="btn btn-primary" onClick="clswidth()">清除图片宽</a>
                                <a class="btn btn-primary" onClick="uploadimg()">上传图片</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__PUBLIC__/js/plugins/jqgrid/i18n/grid.locale-cnffe4.js?0820"></script>
<script src="__PUBLIC__/js/plugins/jqgrid/jquery.jqGrid.minffe4.js?0820"></script>
<script src="__PUBLIC__/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/js/plugins/summernote/summernote.min.js"></script>
<script src="__PUBLIC__/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>

<script>
    $(document).ready(function(){
        //一级
        $(".select-1").change(function(){
            //获取下一级所有地址
            $.ajax({
                type : "POST",
                dataType : "json",
                url: "__MODULE__/Area/getnext/rid/"+$(".select-1").val(),
                async:false,
                success: function(data){
                    //展示下一级地区
                    var instr="<option value='0'>请选择</option>";
                    for(var i=0;i<data.length;i++){
                        instr+="<option value='"+data[i].id+"'>"+data[i].name+"		编号:"+data[i].area_id+"（"+data[i].id+"）"+"</option>";
                    }//end for
                    $(".select-2 option").remove();//移除所有option
                    $(".select-3 option").remove();//移除所有option
                    $(".select-2").append(instr);//添加新的option
                }
            });//end ajax

        });//end change

    });


    //搜索店铺
    function searchStore() {
        var store_key = $("input[name='store_key']").val();
        if(store_key){
            $.post('<?=U("ExchangeGoods/searchStore")?>',{store_key:store_key},function(data){
                if(data!=''){
                    //展示搜索结果
                    var instr = "<option>请选择店铺</option>";
                    for(var i=0;i<data.length;i++){
                        instr+="<option value='"+data[i].c_id+"'> "+data[i].storename+"（"+data[i].address+"）"+"</option>";
                    }//end for
                    $(".store-select option").remove();//移除所有option
                    $(".store-select").append(instr);//添加新的option
                }else{
                    var instr="<option value='0'>没有结果</option>";
                    $(".store-select option").remove();//移除所有option
                    $(".store-select").append(instr);//添加新的option
                }
            });
        }else{
            layer.msg('请先输入店铺名称');
        }
    }

    //选择店铺
    $(".store-select").change(function(){
        var c_id = $('.store-select option:selected').val();
        var store = $(".store-select option:selected").html();
        // 移除该条信息
        $('.store-select option:selected').remove();
        // 右侧出现选择的店铺信息
        var store_str = '<p class="store-p" style="position: relative">' +
            '<input class="form-control" type="text" value="'+store+'">' +
            '<input type="hidden" name="c_id[]" value="'+c_id+'">' +
            '<button type="button" class="btn btn-danger btn-store" onclick="re(this)"  style="position: absolute;top: 0px;left: 499px;height: 34px;">移除</button>' +
            '</p>';
        $(".store-input").append(store_str);   //追加新的店铺信息
        // 小区隐藏input最近该信息
    });

    // 移除店铺
    function re(a) {
        $(a).parent(".store-p").remove();
    }

</script>

<script>
    // <!--富文本-->
    $(document).ready(function(){
        $(".summernote").summernote({lang:"zh-CN"});
        $(".note-editor").css("width","70%");
        $(".note-editor").css("float","left");
        $(".note-editable").css("height","308px");
    });
    var edit=function(){$("#eg").addClass("no-padding");$(".click2edit").summernote({lang:"zh-CN",focus:true})};var save=function(){$("#eg").removeClass("no-padding");var aHTML=$(".click2edit").code();$(".click2edit").destroy()};
</script>

<script>
    // 保存
    function save(){
        html = $(".note-editable").html();
        $("textarea[name='content']").text(html);
        $("#formSubmit").submit();
    }//end fun

    //清除插入的图片宽度
    function clswidth(){
        $(".note-editable").find("img").css('width','');

    }//end fun
    $.ajaxSetup({
        async : false
    });
    //上传图片
    function uploadimg() {
        $(".note-editable img").each(function (index,item) {
            var pic = $(item).attr('src');
            // // 判断图片地址是否包含base64字符串，包含则说明没有上传图片
            if(pic.indexOf("base64") >= 0 ) {
                $.post('http://imgs.xiangtws.com/Api/Index/uploadPic',{pic:pic,domain:'http://www.xiangtws.com'},function (data) {
                    $(item).attr('src',data);
                })
            }
        });
    }

</script>
</body>


<!-- Mirrored from /theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
</html>
